# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=parted
pkgver=3.5
pkgrel=0
pkgdesc="Utility to create, destroy, resize, check and copy partitions"
url="https://www.gnu.org/software/parted/parted.html"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-dev $pkgname-doc"
checkdepends="perl eudev util-linux"
makedepends="readline-dev ncurses-dev lvm2-dev bash util-linux-dev"
source="https://ftp.gnu.org/gnu/parted/parted-$pkgver.tar.xz
	fix-includes.patch
	fix-libintl-header-s390x.patch
	parted-include-sysmacros.patch
	fix-truncate-tests.patch
	make-tests.patch
	skip-duplicate-bsd-test-on-s390x.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-debug \
		--disable-nls \
		--disable-static \
		--enable-shared
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}
sha512sums="
87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a  parted-3.5.tar.xz
55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd  fix-includes.patch
444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc  fix-libintl-header-s390x.patch
ba86cd2591d8e920e474faf28a32f9eaca9482e168c53eae5d392276aefaf6c46b66a0d5fc4a18b7186bf38f7288bd79de8ba8019c1cd38a5e2102904ce75723  parted-include-sysmacros.patch
cca125b891739fd65c38a05638105ea15f77a71b9780af891bb56523b67e9ec3188be18109c3166be445bc03409de85d09e994d7dbbe13d663312df7dda2a2fa  fix-truncate-tests.patch
8bf7fce435092baba6855cefca75b701124941741417e2f7f5b78f68da5c0f33013232b411fa04b3532c37c347d75bbfa9279221985d0f0080d1b2a48863e6c1  make-tests.patch
42120158f44705b416162edd5e2d61635d34ff88878d84fc8110a169fd927ec3d714376a52e60e55d041e80afd8edad6429b1b5897e0738d23c6583a7bfc09bc  skip-duplicate-bsd-test-on-s390x.patch
"
